import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:bookapp/helpers/constants.dart';
import 'package:provider/provider.dart';
import 'package:bookapp/stores/find_store.dart';

class FindNavBar extends StatelessWidget {
  const FindNavBar({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final findStore = Provider.of<FindStore>(context);

    return Observer(
      builder: (_) => AppBar(
        title: Text("发现"),
        centerTitle: true,
        elevation:0,
        actions: <Widget>[
          IconButton(
            alignment: Alignment.centerRight,
            onPressed: (){
              findStore.setTile('tile',true);
              findStore.counter();
            },
            icon: SvgPicture.asset(
              "assets/icon/icon_more.svg",
              width: Constants.appBarIconSize + 2.0,
              height: Constants.appBarIconSize + 2.0,
              color: Color(findStore.tile ? AppColors.fontColor : AppColors.fontColorGray),
            ),
          ),

          IconButton(
            alignment: Alignment.centerLeft,
            onPressed: (){
              findStore.setTile('tile',false);
              findStore.counter();
            },
            icon: SvgPicture.asset(
              "assets/icon/icon_cube.svg",
              width: Constants.appBarIconSize + 2.0,
              height: Constants.appBarIconSize + 2.0,
              color: Color(findStore.tile ? AppColors.fontColorGray : AppColors.fontColor),
            ),
          ),
        ],
      ),
    );
  }
}
